version: "3.3"

services:
  jaegertracing:
    image: jaegertracing/all-in-one:1.41.0
    environment:
      COLLECTOR_OTLP_ENABLED: "true"
    ports:
      # - "5775:5775/udp" # Agent - deprecated; only used by very old Jaeger clients
      - "6831:6831/udp" # Agent - Thrift protocol used by most current Jaeger clients
      - "6832:6832/udp" # Agent - protocol for Node.js Jaeger client
      - "5778:5778"     # Agent - serve configs, sampling strategies
      - "16686:16686"   # Web UI
      - "14268:14268"   # Collector - HTTP can accept spans directly from clients in jaeger.thrift format over binary thrift protocol
      - "14250:14250"   # Collector - used by jaeger-agent to send spans in model.proto format
      - "4317:4317"     # Collector - OTLP gRPC
      - "4318:4318"     # Collector - OTLP HTTP

  nginx:
    image: bigkaa/application_otlp_nginx:1.23.1
    build:
      context: nginx
    ports:
      - "8080:80"
    volumes:
      - ${PWD}/nginx/nginx.conf:/etc/nginx/nginx.conf
      - ${PWD}/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
      - ${PWD}/nginx/opentelemetry_module.conf:/etc/nginx/conf.d/opentelemetry_module.conf

  application1:
    image: bigkaa/application1:v0.0.3
    build:
      context: application1
    ports:
      - "5001:5000"
    environment:
      APP2: "http://application2:5000"
      OTEL_EXPORTER_JAEGER_AGENT_HOST: "jaegertracing"
      OTEL_EXPORTER_JAEGER_AGENT_PORT: 6831

  application2:
    image: bigkaa/application2:v0.0.3
    build:
      context: application2
    ports:
      - "5002:5000"
    environment:
      OTEL_EXPORTER_JAEGER_AGENT_HOST: "jaegertracing"
      OTEL_EXPORTER_JAEGER_AGENT_PORT: 6831
